import $ from 'jquery';
import Button from './Button';


export default class FullScreenButton extends Button {

  _init() {
    let result = super._init();
    this.title = `${this._t(this.name)} (full screen)`;
    this.el.click(this.toggleFullScreen.bind(this));
    return result;
  }

  _status() {
    return this.active;
  }

  toggleFullScreen(e) {
    e.stopPropagation();
    e.preventDefault();
    this.getEditor().el.toggleClass("sim-fullscreen");
    this.setActive(this.getEditor().el.hasClass("sim-fullscreen"));
    if (this.active) {
      this.el.find(".simditor-icon").removeClass("ion-arrow-expand").addClass("ion-arrow-shrink");
    } else {
      this.el.find(".simditor-icon").addClass("ion-arrow-expand").removeClass("ion-arrow-shrink");
    }

  }

  command() {
  }
}

FullScreenButton.prototype.name = 'fullscreen';
FullScreenButton.prototype.icon = ' ion-arrow-expand';